# import matplotlib.pyplot as plt
# import numpy as np
# x = np.linspace(0, 2 * np.pi, 100)
# y_sin = np.sin(x)
# y_cos = np.cos(x)
# plt.plot(x, y_sin, label='正弦 (Sine)')
# plt.plot(x, y_cos, label='余弦 (Cosine)')
# plt.legend() # 关键步骤
# plt.show()

import numpy as np
import matplotlib.pyplot as plt
# 随机生成 50 个 x 和 y 坐标
x_scatter = np.random.rand(50) * 100
y_scatter = np.random.rand(50) * 100

# 随机生成一个表示颜色的变量
colors = np.random.rand(50)

# # 打印数据以供参考
# print("x_scatter:", x_scatter)
# print("y_scatter:", y_scatter)
# print("colors:", colors)

plt.scatter(x_scatter, y_scatter, c=colors, cmap='viridis')
# plt.plot(x_scatter,y_scatter,"o:r",color = colors)
plt.show()